

package jetbrains.buildServer.server.rest.util;

import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.Nullable;

public interface StringPool {
  /**
   * Ask the pool to reuse given string, it's up to implementation to decide if it will do that.
   *
   * <p>
   * Implementation must guarantee <code>reuse(a).equals(reuse(b))</code> for <code>a.equals(b)</code>.
   * Implementation does NOT have to guarantee <code>reuse(a) == reuse(b)</code> for <code>a.equals(b) && a != b</code>.
   * </p>
   * @param value
   * @return
   */
  @Contract("null -> null, !null -> !null")
  public String reuse(@Nullable String value);
}